package com.fxwater.websocket;


import com.fxwater.websocket.job.SelectRealData;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.redis.core.StringRedisTemplate;

import javax.annotation.PostConstruct;
import java.util.List;

@SpringBootApplication
@ComponentScan("com.fxwater.websocket.*")
@MapperScan("com.fxwater.*.mapper")
public class WebsocketApplication {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    public static WebsocketApplication websocketApplication;
    @PostConstruct
    public void init(){
        websocketApplication = this;
        websocketApplication.stringRedisTemplate = this.stringRedisTemplate;
    }

    public static String getKey(){
        String key =websocketApplication.stringRedisTemplate.opsForList().index("a1", 0);
        return key;
    }

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(WebsocketApplication.class);
        springApplication.addListeners(new WebsocketServletInitializer());
        springApplication.run(args);
        System.out.println("websocket启动成功");
    }

}
